package com.jddup.program.comparator;

import com.jddup.common.pojo.TableColumn;
import com.jddup.common.pojo.TableMeta;

/**
 * Created by zhangzhenbin on 17-12-11.
 */
public interface AddPkDDLBuilder {
    String addSqlTemplate();
    String dropSqlTemplate();
    default String build(TableMeta tableMeta,TableColumn tableColumn){
        return addSqlTemplate()
                .replace("{tableName}",tableMeta.getTableName())
                .replace("{pkColumn}",tableColumn.getColumnName());
    }
    default String removeOld(TableMeta tableMeta,String oldPk){
        return dropSqlTemplate()
                .replace("{tableName}",tableMeta.getTableName())
                .replace("{pkColumn}",oldPk);
    }

}
